#ifndef GLOBAL_H
#define GLOBAL_H

#include "config.h"

#ifndef _TYPE_DEFINED
#define _TYPE_DEFINED

typedef unsigned char  uchar;
typedef unsigned short ushort;
typedef unsigned int   uint;
typedef unsigned long  ulong;

typedef unsigned char   U8;
typedef unsigned short  U16;
typedef unsigned long   U32;

#endif// _TYPE_DEFINED

#define UNUSED(x)               ((x)=(x))
#ifndef _STR
#define __STR(x)                #x
#define _STR(x)                 __STR(x)
#endif


//------------------------------------------------------------------------------
// 常量定义
//------------------------------------------------------------------------------

// 系统频率
#define SYSCLK                          INTCLK

#define UNUSED(x)       ((x)=(x))

#define max(a, b)       ((a) > (b) ? (a) : (b))
#define min(a, b)       ((a) < (b) ? (a) : (b))

//------------------------------------------------------------------------------
// 数据类型
//------------------------------------------------------------------------------

#define MSB             0
#define LSB             1

typedef union tagUU16
{
    U8  U8[2];
    U16 U16;
} UU16;

typedef struct FILE_DESC
{
    ushort mask;
    ushort count;
    union
    {
        ushort *w;
        float *f;
    } ptr;
} FILE_DESC;

typedef struct RECT
{
    long x0;
    long y0;
    long x1;
    long y1;
} RECT;

#endif // GLOBAL_H
